import type {  CardAddParams, CardDetail, CardListData, CardListParams, RuleListData, RuleListParams} from "@/types/card"
import { request } from "@/utils/reuqest"

/**
 * 查看月卡信息列表
 * @param params 
 * @returns 
 */
export const getCardListAPI = (params: CardListParams) => {
  return request<CardListData>('/parking/card/list', 'GET', params)
}

/** 
 * 添加月卡信息
 * @param data
 * @returns
 */

export const addCardAPI = (params: Partial<CardAddParams>) => {
  return request('/parking/card','POST',params)
}

/**
 * 获取月卡详情
 * @data
 * @returns
 */

export const getCardListDetailAPI = (id: string) => {
  return request<CardDetail>(`/parking/card/detail/${id}`,'GET')
}

/**
 * 编辑月卡
 * @param {*} data
 * @returns
 */

export const editCardAPI = (data: Partial<CardDetail>) => {
  return request('/parking/card/edit','PUT',data)
}

/**
 * 删除月卡
 * @param {*} data
 * @returns
 */

export const deleteCardAPI = (ids: number[]) => {
  return request(`/parking/card/${ids}`,'DELETE')
}

/**
 * 获取规则列表
 * @param { page, pageSize } params
 * @returns
 */
export const getRuleListAPI = (params: RuleListParams) => {
  return request<RuleListData>('/parking/rule/list', 'GET', params)
}